home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Source / GNU / libg++ / libiberty / vsprintf.c < prev    next >
C/C++ Source or Header  |  1994-02-15  |  2KB  |  51 lines

  1. /* Simple implementation of vsprintf for systems without it.
  2.    Highly system-dependent, but should work on most "traditional"
  3.    implementations of stdio; newer ones should already have vsprintf.
  4.    Written by Per Bothner of Cygnus Support.
  5.    Based on libg++'s "form" (written by Doug Lea; dl@rocky.oswego.edu).
  6.    Copyright (C) 1991 Free Software Foundation, Inc.
  7.  
  8. This file is part of the libiberty library.
  9. Libiberty is free software; you can redistribute it and/or
  10. modify it under the terms of the GNU Library General Public
  11. License as published by the Free Software Foundation; either
  12. version 2 of the License, or (at your option) any later version.
  13.  
  14. Libiberty is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17. Library General Public License for more details.
  18.  
  19. You should have received a copy of the GNU Library General Public
  20. License along with libiberty; see the file COPYING.LIB.  If
  21. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  22. Cambridge, MA 02139, USA.  */
  23.  
  24. #include <varargs.h>
  25. #include <stdio.h>
  26. #include <ansidecl.h>
  27. #undef vsprintf
  28.  
  29. int
  30. vsprintf (buf, format, ap)
  31.      char *buf;
  32.      const char *format;
  33.      va_list ap;
  34. {
  35.   FILE b;
  36.   int ret;
  37. #ifdef VMS
  38.   b->_flag = _IOWRT|_IOSTRG;
  39.   b->_ptr = buf;
  40.   b->_cnt = 12000;
  41. #else
  42.   b._flag = _IOWRT|_IOSTRG;
  43.   b._ptr = buf;
  44.   b._cnt = 12000;
  45. #endif
  46.   ret = _doprnt(format, ap, &b);
  47.   putc('\0', &b);
  48.   return ret;
  49.  
  50. }
  51.